﻿using NoteSystem.Utils;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Security.Policy;
using System.Security.Principal;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NoteSystem
{
    public partial class Note : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnPublic_Click(object sender, EventArgs e)
        {
            //日志发布   insert
            string title=txtTitle.Text;
            string detail = txtDetail.Value;
            DataRow userRow = (DataRow)Session["User"];
            int user_id = Convert.ToInt32(userRow["id"]);
            //数据库插入
            string sql = string.Format(@"insert into notes values('{0}','{1}',{2},'{3}',0)", title, detail, user_id, DateTime.Now);
            //执行更新操作
            int flag = DbHelper.ExecuteSql(sql);
            if (flag > 0)
            {
                Response.Redirect("Index.aspx");
            }
        }
    }
}